package com.malty.shardingsphere.controller;

import com.malty.shardingsphere.domain.Employee;
import com.malty.shardingsphere.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author malty
 */
@RestController
@RequestMapping("/employee")
public class EmployeeController {
    @Autowired
    private EmployeeService employeeService;

    @PostMapping("/create")
    public Boolean createOne(@RequestBody Employee employee) {
        return employeeService.create(employee);
    }

    @GetMapping("/list")
    public List<Employee> list() {
        return employeeService.listAll();
    }
}
